﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLKS.SysLib;
using System.Management;

namespace QLKS.Models
{
    static public class RegisterModel
    {
        static public bool Register(string id, string serial)
        {
            RegisterLib.RegisterValue(id,serial);
            return RegisterLib.IsRegisted;
        }

        static public string GetID()
        {
            string ID = string.Empty;
            ManagementObjectSearcher SearchProcessor = new ManagementObjectSearcher("select * from Win32_Processor");
            foreach (ManagementObject field in SearchProcessor.Get())
            {
                foreach (PropertyData PC in field.Properties)
                {
                    if (PC.Name.ToUpper().Equals("PROCESSORID"))
                        return PC.Value.ToString();
                    else
                        continue;
                }
                    break;
            }
            return ID;
        }
    }
}
